Skip to content

Enforce progressive-list soft limits at network decode time - #11263

Open
tbenr wants to merge 1 commit into
Consensys-Incorporated:masterfrom
tbenr:Enforce-progressive-list-soft-limits-at-network-decode-time
Open

Enforce progressive-list soft limits at network decode time#11263
tbenr wants to merge 1 commit into
Consensys-Incorporated:masterfrom
tbenr:Enforce-progressive-list-soft-limits-at-network-decode-time

Conversation

@tbenr

@tbenr tbenr commented Sep 11, 2026

Copy link
Copy Markdown
Contributor

Makes sure that limits that are part of the state transition function are applied at message decoding phase (GOSSIP as well as RPC) so we early drop them. REJECT and peer downscore during sync (RPC) are ensured.

The alternative is just reordering the gossip checks so that those limits are checked earlier.
This is more invasive approach, tightening the check to the schema itself, bringing the benefit that we apply it on RPC side too (we don't need to fill a batch, start the import, to find out that some data is invalid)

related to #11228
ref: ethereum/consensus-specs#5564

Out of scope, DAS column retrieval and other RPC consumers outside forward sync do not penalize malformed responses either; a central hook in DefaultEth2Peer.sendEth2Request could cover them later.

Documentation

  • I thought about documentation and added the doc-change-required label to this PR if updates are required.

Changelog

  • I thought about adding a changelog entry, and added one if I deemed necessary.

Note

Cursor Bugbot is generating a summary for commit c3eede3. Configure here.

Comment thread specrefs/functions.yml
sources:
- file: ethereum/spec/src/main/java/tech/pegasys/teku/spec/datastructures/util/GloasNetworkLimits.java
search: public static Optional<LimitViolation> verifyBlockBodyOperationLimits(
- file: ethereum/spec/src/main/java/tech/pegasys/teku/spec/datastructures/util/GloasNetworkLimits.java

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

1st ref looks sufficient, as it contains most of the logic linked to the spec method

Comment thread specrefs/functions.yml
sources:
- file: ethereum/spec/src/main/java/tech/pegasys/teku/spec/datastructures/util/GloasNetworkLimits.java
search: public static Optional<LimitViolation> verifyExecutionRequestsLimits(
- file: ethereum/spec/src/main/java/tech/pegasys/teku/spec/datastructures/util/GloasNetworkLimits.java

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

1st ref looks sufficient, as it contains most of the logic linked to the spec method

this(beaconBlockSchema, containerName, OptionalLong.empty(), Optional.empty());
}

public SignedBeaconBlockSchema(

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe add Javadocs to different constructors, something like validation required starting from Gloas or smth like that

try {
return type.sszDeserialize(message);
final T decoded = type.sszDeserialize(message);
type.getNetworkSszValidator().ifPresent(validator -> validator.validate(decoded));

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

if exception is thrown in validator, description is lost in catch

markAsInvalid();
} else if (rootCause instanceof MalformedDataException) {
LOG.debug("Malformed response received while requesting batch data", error);
markAsInvalid();

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Now any MalformedDataException causes up to 12 hours peer ban which includes for example MessageTruncatedException. I'd carefully review list affected exception and also add JavaDoc to markAsInvalid() so everyone knows which kind of penalty is it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants